package com.ctshk.sapp.order.tour.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.PageResponse;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.order.tour.dto.SeriesOrderTouristRefundDetailListDTO;
import com.ctshk.rpc.order.tour.dto.SeriesOrderTouristRefundDetailListTripDTO;
import com.ctshk.rpc.order.tour.req.SeriesOrderTouristRefundDetailListReq;
import com.ctshk.rpc.order.tour.req.SeriesOrderTouristRefundDetailListTripReq;
import com.ctshk.rpc.order.tour.service.ISeriesOrderTouristRefundDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 系列团退款明细 前端控制器
 * </p>
 *
 * @author 谭响
 * @since 2021-01-28
 */
@Api(value="退款明细", tags="退款明细")
@RestController
@RequestMapping("/series/order/tourist/refund/detail")
public class SeriesOrderTouristRefundDetailController extends BaseController {

    @DubboReference
    private ISeriesOrderTouristRefundDetailService iSeriesOrderTouristRefundDetailService;

    @ApiOperation(value = "退款明细", notes = "列表（退款管理-退款明细）")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.QUERY, operTitle = "退款管理-退款明细", operDesc = "退款管理-退款明细")
    @PostMapping("/list")
    public Result<PageResponse<SeriesOrderTouristRefundDetailListDTO>> list(@RequestBody @Valid SeriesOrderTouristRefundDetailListReq req) {
        req.setUserId(getCurrentUser(getRequest()).getId());
        return Result.success(iSeriesOrderTouristRefundDetailService.list(req));
    }

    @ApiOperation(value = "列表团期", notes = "列表（旅行團詳情-退款明細）")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.QUERY, operTitle = "旅行團詳情-退款明細", operDesc = "旅行團詳情-退款明細")
    @PostMapping("/list/trip")
    public Result<PageResponse<SeriesOrderTouristRefundDetailListTripDTO>> listTrip(@RequestBody @Valid SeriesOrderTouristRefundDetailListTripReq req) {
        req.setUserId(getCurrentUser(getRequest()).getId());
        return Result.success(iSeriesOrderTouristRefundDetailService.listTrip(req));
    }

}
